﻿<Window x:Class="ISRecord.View.SelectSheetDialog"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="SelectSheetDialog" Height="300" Width="300"
        FlowDirection="RightToLeft" WindowStartupLocation="CenterScreen">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="216*" />
            <RowDefinition Height="45*" />
        </Grid.RowDefinitions>
        <ListBox Margin="5" Grid.Row="0" ItemsSource="{Binding}"
                 ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                 SelectionChanged="ListBox_SelectionChanged">

            <ListBox.ItemContainerStyle>
                <!--Handle ListBoxItem Double Click event to be as use pressed Ok button-->
                <Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
                    <EventSetter Event="MouseDoubleClick" Handler="ListBoxItemDoubleCliked"/>
                </Style>
            </ListBox.ItemContainerStyle>
            <ListBox.ItemsPanel>
                <!--Override this to handle wrapping list items. -->
                <ItemsPanelTemplate>
                    <WrapPanel/>
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Border Width="250"  Margin="5" >
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <Image Grid.Column="0" Grid.Row="0" Grid.RowSpan="2" Source="{StaticResource ExcelSheetImage}" Width="32" Height="32"/>
                            
                            <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Path=''}" FontSize="18" 
                                       FontWeight="Bold" Margin="5,0,0,0" />
                        </Grid>
                    </Border>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <StackPanel Grid.Row="1" Orientation="Horizontal">
            <Button Content="{StaticResource OkImage}" Margin="5" Click="OkClicked" />
            <Button Content="{StaticResource CancelImage}" Margin="5" Click="CancelClicked" />
        </StackPanel>
    </Grid>
</Window>
